package com.nineyang;

import com.nineyang.model.Role;
import com.nineyang.repository.RoleMapper;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.List;

@MapperScan(basePackages = {"com.nineyang.repository"})
@SpringBootApplication
public class Sb308MybatisApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(Sb308MybatisApplication.class, args);

        RoleMapper roleMapper = applicationContext.getBean("roleMapper", RoleMapper.class);
        List<Role> roles = roleMapper.selectAll();
        roles.forEach(System.out::println);
        applicationContext.close();
    }

}
